/* linkit.js
 * By François Leporcq
 * MIT Licensed.
 */
var ECardinalPoint = {
    NORTH: "north",
    EAST: "east",
    SOUTH: "south",
    WEST: "west",
    get: function(cardinalPoint) {
        switch (cardinalPoint) {
            case "north":
                return this.NORTH;
                break;
            case "east":
                return this.EAST;
                break;
            case "south":
                return this.SOUTH;
                break;
            case "west":
                return this.WEST;
                break;
            default :
                throw new Error("Unknown value for ECardinalPoint");
                break;

        }
    },
    areOpposite: function(firstCardinalPoint,sencondCardinalPoint){
        if(firstCardinalPoint == ECardinalPoint.SOUTH && sencondCardinalPoint == ECardinalPoint.NORTH){
            return true;
        }
        if(firstCardinalPoint == ECardinalPoint.NORTH && sencondCardinalPoint == ECardinalPoint.SOUTH){
            return true;
        }
        if(firstCardinalPoint == ECardinalPoint.EAST && sencondCardinalPoint == ECardinalPoint.WEST){
            return true;
        }
        if(firstCardinalPoint == ECardinalPoint.WEST && sencondCardinalPoint == ECardinalPoint.EAST){
            return true;
        }
        return false;
    },
    getOpposite: function(cardinalPoint){
        if(cardinalPoint == ECardinalPoint.SOUTH){
            return ECardinalPoint.NORTH;
        }
        if(cardinalPoint == ECardinalPoint.NORTH){
            return ECardinalPoint.SOUTH;
        }
        if(cardinalPoint == ECardinalPoint.EAST){
            return ECardinalPoint.WEST;
        }
        if(cardinalPoint == ECardinalPoint.WEST){
            return ECardinalPoint.EAST;
        }
        return null;
    }
}